<template>
  <div class="count">
    <h1>
      {{ count }}
    </h1>
    <button @click="add(num)">点我累加</button>
    
  </div>
</template>

<script>
export default {
  name: "Count",
  data(){
    return{
      count:0
    }
  },
  methods:{
    add(num){
      this.count+=num
    },
  },
  props:["num"]
};
</script>

<style scoped>
.count {
  background: yellow;
  height: 100px;
}
</style>